package demo2;

// LightOnCommand.java
public class LightOnCommand implements Command {
    private Light light;

    public LightOnCommand(Light light) {
        this.light = light;
    }

    @Override
    public void execute() {
        light.on();  // 调用灯的打开方法
    }

    @Override
    public void undo() {
        light.off(); // 撤销就是关灯
    }
}
